﻿using Abp.Application.Services.Dto;
using Abp.AspNetCore.Mvc.Controllers;
using Batman.Cms.Core.Core.Attributes;
using Batman.Cms.Services.Applications;
using Batman.Cms.Services.Applications.Filters;
using Batman.Cms.Services.Applications.Inputs;
using Microsoft.AspNetCore.Mvc;

namespace Batman.Cms.Controllers.Applications
{
    public class ApplicationController : AbpController
    {
        public ApplicationReader applicationReader { get; set; }

        public ApplicationManager applicationManager { get; set; }

        /// <summary>
        /// 获取应用列表接口
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        [AcceessOriginal]
        public ActionResult Get(ApplicationFilter filter, PagedResultRequestDto page)
        {
            var results = applicationReader.Get(filter, page);

            return Json(results);
        }

        [AcceessOriginal]
        public ActionResult Create(CreateApplicationInput model)
        {
            var result = applicationManager.Create(model);
            return Json(result);
        }
    }
}
